#include "WriteFile.h"

namespace Core
{
	rtWriteFile::rtWriteFile(void)
	{
	}


	rtWriteFile::~rtWriteFile(void)
	{
	}

	int rtWriteFile::write(const void* buf, int len)
	{
		return 0;
	}

	int rtWriteFile::writeInt(const int value)
	{
		return writeData(value);
	}

	int rtWriteFile::writeUnsignedInt(const unsigned int value)
	{
		return writeData(value);
	}

	int rtWriteFile::writeShort(const short value)
	{
		return writeData(value);
	}

	int rtWriteFile::writeUnsignedShort(const unsigned short value)
	{
		return writeData(value);
	}

	int rtWriteFile::writeChar(const char value)
	{
		return writeData(value);
	}

	int rtWriteFile::writeUnsignedChar(const unsigned char value)
	{
		return writeData(value);
	}

	int rtWriteFile::writeByte(const unsigned char value)
	{
		return writeData(value);
	}

	int rtWriteFile::writeFloat(const float value)
	{
		return writeData(value);
	}

	int rtWriteFile::writeBool(const bool value)
	{
		unsigned char byteValue = value ? 1 : 0;
		return writeData(byteValue);
	}

	int rtWriteFile::writeString(const std::string& value)
	{
		const char* cStr = value.c_str();
		int len = value.length();
		writeInt(len);
		return writeArrayData(cStr, len);
	}

	int rtWriteFile::writeVector2(const rtVector2& value)
	{
		rtVector2 v = value;
		return write(&v[0], sizeof(rtVector2));
	}

	int rtWriteFile::writeVector3(const rtVector3& value)
	{
		rtVector3 v = value;
		return write(&v[0], sizeof(rtVector3));
	}

	int rtWriteFile::writeVector4(const rtVector4& value)
	{
		rtVector4 v = value;
		return write(&v[0], sizeof(rtVector4));
	}

	int rtWriteFile::writeMatrix3(const rtMatrix3& value)
	{
		rtMatrix3 m = value;
		return write(&m[0], sizeof(rtMatrix3));
	}

	int rtWriteFile::writeMatrix4(const rtMatrix4& value)
	{
		rtMatrix4 m = value;
		return write(&m[0], sizeof(rtMatrix4));
	}
}

